package com.itheima.controller;

import com.itheima.pojo.BsUser;
import com.itheima.service.UsersService;
import com.itheima.util.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/users")
public class UsersController {

    @Autowired
    private UsersService usersService;
    @Autowired
    private HttpServletRequest request;

    @GetMapping("/simple")
    public List<Users> simple(){
        String cookie = request.getHeader("Authorization");
        String[] split = cookie.split(" ");
        String s = split[1];
        return usersService.findById(s);
    }

}
